const { defineConfig } = require('@vue/cli-service')
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin")
module.exports = defineConfig({
//   chainWebpack: config => {
//   //在 chainWebpack 添加下面的一段代码
//     config.externals({ "./cptable": "var cptable" });
//   },
// 解决
configureWebpack: {
  plugins: [
    new NodePolyfillPlugin()
  ],
    externals: {
      './cptable': 'var cptable'
    },
    resolve: {
      fallback: {
        fs: false,
        crypto: false,
      }
    },
  },
  transpileDependencies: true,
  devServer: {
    proxy: {
        '/api': {
            target: 'http://10.32.20.38:8092',
            changeOrigin: true,
            pathRewrite: {
                '^/api': ''
            }
        },
        '/ap': {
          target: 'https://www.fastmock.site/mock/b78005040fd5d0937d04e443ee622aac',
          changeOrigin: true,
          pathRewrite: {
              '^/ap': ''
          }
      },
    }
}
})
